package com.basement.model;


import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table( name = "USERS" )
public class BsmntUser {
/**
 * a) write class User with following fields:
        - first name (25 characters, required)
        - last name (25 characters, required)
        - birthday (java.util.Date, required)
        - sex (enum type, required)
        - height (optional, float with precision of 2)
        - boolean indicating if the account is active (required)
    b) don't forget getters and setters
    c) write a DAO class to read all, read one (by id), delete and save/update users
    d) test all of the methods
    alt, shift, s + R
 */
	
	@Id
	@GeneratedValue(generator="increment")
	@GenericGenerator(name="increment", strategy = "increment")
	@Column(name = "USER_ID")
	private Long id;
	
	@Column(name="USER_NAME", nullable=false, length=25)
	private String name;
	
	@Column(name="USER_LAST_NAME",nullable=false, length=25)
	private String lastName;
	
	@Column(name="USER_BIRTHDAY", nullable=false )
	private Date birthday;
	
	@Column(name="USER_HEIGHT", nullable=true )
	private float height;
	
	@Column(name="USER_ACTIVE_ACCOUNT", nullable=false )
	private boolean activeAccount;
	
	public BsmntUser() {
		// this form used by Hibernate
	}
	
	public BsmntUser(String name, String lastName, Date birthday, boolean activeAccount) {
		this.name = name;
		this.lastName = lastName;
		this.birthday = birthday;
		this.activeAccount = activeAccount;
	}
	
	public Long getId() {
		return id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public float getHeight() {
		return height;
	}
	public void setHeight(float height) {
		this.height = height;
	}
	public boolean isActiveAccount() {
		return activeAccount;
	}
	public void setActiveAccount(boolean activeAccount) {
		this.activeAccount = activeAccount;
	}
	
	public void setId(Long id) {
		this.id = id;
	}
	
	
}

